package com.yanqu.road.entity.config.promotion;

import com.yanqu.road.utils.string.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 道具晋升无双的配置,晋升类型13解析出来
 */
public class ItemPeerlessPromotionInfo {
    private int peerlessSkillId; //国色无双技能id
    private List<Integer> promotionSkills = new ArrayList<>(); //缘定三生技能
    private List<Integer> levelNeed = new ArrayList<>();

    public ItemPeerlessPromotionInfo(String str) {
        //            孔位技能;孔位1三生技能,孔位2三生技能,孔位3三生技能|等级需求；等级需求；等级需求；等级需求；等级需求
        String[] splits = str.split("\\|");
        String[] split1 = splits[0].split(";");
        this.peerlessSkillId = Integer.parseInt(split1[0]);
        this.promotionSkills = StringUtils.stringToIntegerList(split1[1], ",");
        this.levelNeed = StringUtils.stringToIntegerList(splits[1], ";");
    }

    public int getPeerlessSkillId() {
        return peerlessSkillId;
    }

    public void setPeerlessSkillId(int peerlessSkillId) {
        this.peerlessSkillId = peerlessSkillId;
    }

    public List<Integer> getPromotionSkills() {
        return promotionSkills;
    }

    public void setPromotionSkills(List<Integer> promotionSkills) {
        this.promotionSkills = promotionSkills;
    }

    public List<Integer> getLevelNeed() {
        return levelNeed;
    }

    public void setLevelNeed(List<Integer> levelNeed) {
        this.levelNeed = levelNeed;
    }

    public int getPromotionSkillId(int pos) {
        if (pos <= 0 || pos > promotionSkills.size()) {
            return 0;
        }
        return promotionSkills.get(pos - 1);
    }

    public int getPeerlessSkillLvUpNeedPromotionSkillLv(int level) {
        return levelNeed.get(level - 1);
    }
}
